﻿//-----------------------------------------------------------------------
// <copyright file="IUsageView.cs" company="Redmist">
//     Copyright (c) Damien T Smith. All rights reserved.
// </copyright>
// <author>Damien Smith</author>
//-----------------------------------------------------------------------

namespace Redmist.UsageMonitor.View
{
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Windows.Forms;
    using Redmist.UsageMonitor.CustomControls;
    using Redmist.UsageMonitor.Model;
    using Redmist.UsageMonitor.Properties;

    /// <summary>Provides an interface to a usage view.</summary>
    public interface IUsageView
    {
        /// <summary>Occurs after the view is closed.</summary>
        event EventHandler ViewClosed;

        /// <summary>Occurs when the view requests a usage update.</summary>
        event EventHandler UsageRequested;

        /// <summary>Occurs when the usage parameters are changed.</summary>
        event EventHandler UsageParametersUpdated;

        /// <summary>Occurs before the view is displayed for the first time.</summary>
        event EventHandler ViewLoad;

        /// <summary>Occurs when the NotifyIcon settings are changed.</summary>
        event EventHandler IconSettingsChanged;

        /// <summary>Occurs when the usage update interval setting is changed.</summary>
        event EventHandler UpdateIntervalChanged;

        /// <summary>Occurs when a mouse movement is registered on a view's usage history graph.</summary>
        event MouseEventHandler GraphMouseMoved;

        /// <summary>Gets a value indicating whether the usage history graphs should show counted rather than off peak usage.</summary>
        bool IsGraphCountedOffPeak { get; }

        /// <summary>Gets a value indicating whether the download and upload graphs should be displayed at the same scale.</summary>
        bool IsSharedGraphScale { get; }

        /// <summary>Gets or sets a System.String representing the phone number setting.</summary>
        string PhoneNumber { get; set; }

        /// <summary>Gets or sets a System.String representing the login password setting.</summary>
        string Password { get; set; }

        /// <summary>Gets a value representing the number of days to show on the usage history graphs.</summary>
        int GraphHistoryDays { get; }

        /// <summary>Gets the current width in pixels of the history graphs.</summary>
        int HistoryGraphWidth { get; }

        /// <summary>Gets the last registered mouse X location on the usage history graphs.</summary>
        int GraphMouseX { get; }

        /// <summary>Gets or sets a Redmist.UsageMonitor.Model.IUsageModel representing the data source model.</summary>
        IUsageModel Model { get; set; }

        /// <summary>Gets or sets a System.Collections.Generic.IList of Redmist.UsageMonitor.Model.HistoryViewMode representing the graph history view mode selection list.</summary>
        IList<HistoryViewMode> HistoryViewModes { get; set; }

        /// <summary>Gets a Redmist.UsageMonitor.Model.HistoryViewMode representing the currently selected graph history view mode.</summary>
        HistoryView SelectedHistoryMode { get; }

        /// <summary>Gets or sets a value representing the usage update interval in minutes.</summary>
        int UpdateIntervalMinutes { get; set; }

        /// <summary>Gets or sets a value representing the usage update timer interval in milliseconds.</summary>
        int TimerIntervalMilliseconds { get; set; }

        /// <summary>Gets or sets a System.Drawing.Icon representing an icon to be displayed for a NotifyIcon.</summary>
        Icon TrayIcon { get; set; }

        /// <summary>Gets the value of the reduced off peak ratio setting.</summary>
        int ReducedOffPeakRatio { get; }

        /// <summary>Gets the value of the fixed off peak quota in megabytes.</summary>
        int FixedOffPeakQuotaMegabytes { get; }

        /// <summary>Gets a Redmist.UsageMonitor.CustomControls.PlanType representing the currently selected off peak plan type.</summary>
        PlanType CurrentPlanType { get; }

        /// <summary>Shows the view.</summary>
        void Show();

        /// <summary>Sets the view location.</summary>
        /// <param name="point">A System.Drawing.Point representing the screen location of the view.</param>
        void SetLocation(Point point);

        /// <summary>Applies the specified settings to the view.</summary>
        /// <param name="usageSettings">A Redmist.UsageMonitor.Properties.IUsageSettings representing application settings.</param>
        void ApplySettings(IUsageSettings usageSettings);

        /// <summary>Retrieves the current settings from the view.</summary>
        /// <param name="usageSettings">A Redmist.UsageMonitor.Properties.IUsageSettings representing application settings.</param>
        void RetrieveSettings(IUsageSettings usageSettings);

        /// <summary>Shows a usage retrieval notification.</summary>
        void ShowRetrievalInProgressMessage();

        /// <summary>Shows a timeout error message to the user.</summary>
        void ShowTimeoutError();

        /// <summary>Shows a connection error message to the user.</summary>
        void ShowConnectionError();

        /// <summary>Shows an authentication error message to the user.</summary>
        void ShowAuthenticationError();

        /// <summary>Shows a processing error message to the user.</summary>
        void ShowProcessingError();

        /// <summary>Shows a time retrieved message to the user.</summary>
        void ShowTimeRetrieved();

        /// <summary>Changes the download history graph tooltip text.</summary>
        /// <param name="downloadToolTip">A System.String representing the text to set.</param>
        void SetDownloadGraphToolTip(string downloadToolTip);

        /// <summary>Changes the upload history graph tooltip text.</summary>
        /// <param name="uploadToolTip">A System.String representing the text to set.</param>
        void SetUploadGraphToolTip(string uploadToolTip);

        /// <summary>Creates a System.Drawing.Graphics representing a GDI+ drawing surface.</summary>
        /// <returns>A System.Drawing.Graphics representing a GDI+ drawing surface.</returns>
        Graphics CreateGraphics();

        /// <summary>Starts the usage retrieval timer.</summary>
        void StartTimer();

        /// <summary>Stops the usage retrieval timer.</summary>
        void StopTimer();
    }
}
